<template>
  <a-tag
    :class="[CaseType, sizeClass(), { fillet: props.fillet }, { ifForm: props.ifForm }, 'myBorder']"
    :color="props.color"
    :bordered="props.bordered"
  >
    <template v-for="(_, key) in $slots" #[key]>
      <div :style="textColor()">
        <slot :name="key"></slot>
      </div>
    </template>
  </a-tag>
</template>
<script setup lang="ts">
  import { computed } from 'vue';
  import { aTagTypes } from './tag';
  import type { TagType } from './tag';

  const props = defineProps({
    tagType: {
      type: String,
      default: 'default',
    },
    color: {
      type: String,
      default: '',
    },
    textColor: {
      type: String,
      default: '',
    },
    size: {
      type: Number,
      default: 24,
    },
    fillet: {
      type: Boolean,
      default: false,
    },
    bordered: {
      type: Boolean,
      default: true,
    },
    ifForm: {
      type: Boolean,
      default: false,
    },
  });

  const textColor = () => {
    return `color : ${props.textColor}`;
  };

  const CaseType = computed<TagType>(() => {
    if (props.tagType == 'primary') {
      return 'primary';
    }
    return 'default';
  });

  const sizeClass = () => {
    if (props.size == 24) {
      return 'size24';
    } else if (props.size == 18) {
      return 'size18';
    } else if (props.size == 28) {
      return 'size28';
    } else if (props.size == 32) {
      return 'size32';
    } else if (props.size == 40) {
      return 'size40';
    }
  };
</script>
<style lang="less" scoped>
  .ant-tag.default {
    background: #ffffff;
    line-height: 24px;
  }
  .fillet {
    border-radius: 100px;
  }
  .ifForm {
    padding-inline: 8px !important;
  }
  .primary {
    color: #0052d9 !important;
    border: 1px solid #0052d9;
  }
  .size18 {
    line-height: 18px !important;
    font-size: 12px;
    padding-inline: 8px;
  }
  .size24 {
    line-height: 24px !important;
    font-size: 12px;
    padding-inline: 8px;
  }
  .size28 {
    line-height: 28px;
    font-size: 14px;
    padding-inline: 16px;
  }
  .size32 {
    line-height: 30px !important;
    font-size: 14px;
    padding-inline: 16px;
  }
  .size40 {
    line-height: 38px !important;
    font-size: 14px;
    padding-inline: 16px;
  }
  .myBorder {
    // border: 1px solid red;
  }
</style>
